<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:dxmvvm="clr-namespace:Mvvm.UI.SplashScreen">

    <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>

    <ControlTemplate x:Key="DefaultWaitIndicator" TargetType="{x:Type ProgressBar}">
        <Grid x:Name="TemplateRoot" SnapsToDevicePixels="true">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Determinate" />
                    <VisualState x:Name="Indeterminate">
                        <Storyboard>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="Path" RepeatBehavior="Forever">
                                <EasingDoubleKeyFrame KeyTime="0" Value="0" />
                                <EasingDoubleKeyFrame KeyTime="0:0:2" Value="359 " />
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Path x:Name="Path" Stretch="None" Fill="{TemplateBinding Foreground}" Data="F1 M 16,0C 17.1046,0 18,0.895433 18,2C 18,3.10457 17.1046,4 16,4C 14.8954,4 14,3.10457 14,2C 14,0.895433 14.8954,0 16,0 Z M 23,2.00003C 24.1045,2.00003 25,2.89546 25,4.00003C 25,5.1046 24.1045,6.00003 23,6.00003C 21.8954,6.00003 21,5.1046 21,4.00003C 21,2.89546 21.8954,2.00003 23,2.00003 Z M 28,7.00002C 29.1045,7.00002 30,7.89546 30,9.00002C 30,10.1046 29.1045,11 28,11C 26.8954,11 26,10.1046 26,9.00002C 26,7.89546 26.8954,7.00002 28,7.00002 Z M 30,14C 31.1045,14 32,14.8954 32,16C 32,17.1046 31.1045,18 30,18C 28.8954,18 28,17.1046 28,16C 28,14.8954 28.8954,14 30,14 Z M 28,21C 29.1045,21 30,21.8954 30,23C 30,24.1046 29.1045,25 28,25C 26.8954,25 26,24.1046 26,23C 26,21.8954 26.8954,21 28,21 Z M 23,26C 24.1045,26 25,26.8954 25,28C 25,29.1046 24.1046,30 23,30C 21.8954,30 21,29.1046 21,28C 21,26.8954 21.8954,26 23,26 Z M 16,28C 17.1046,28 18,28.8954 18,30C 18,31.1046 17.1046,32 16,32C 14.8954,32 14,31.1046 14,30C 14,28.8954 14.8954,28 16,28 Z M 9,26C 10.1046,26 11,26.8954 11,28C 11,29.1046 10.1046,30 9,30C 7.89543,30 7,29.1046 7,28C 7,26.8954 7.89543,26 9,26 Z M 4,21C 5.10457,21 6,21.8954 6,23C 6,24.1046 5.10457,25 4,25C 2.89543,25 2,24.1046 2,23C 2,21.8954 2.89543,21 4,21 Z M 2,14C 3.10457,14 4,14.8954 4,16C 4,17.1046 3.10457,18 2,18C 0.895431,18 1.19209e-006,17.1046 1.19209e-006,16C 1.19209e-006,14.8954 0.895431,14 2,14 Z M 4,7.00001C 5.10457,7.00001 6,7.89544 6,9.00001C 6,10.1046 5.10457,11 4,11C 2.89543,11 2,10.1046 2,9.00001C 2,7.89544 2.89543,7.00001 4,7.00001 Z M 9,2C 10.1046,2 11,2.89544 11,4C 11,5.10457 10.1046,6 9,6C 7.89543,6 7,5.10457 7,4C 7,2.89544 7.89543,2 9,2 Z " RenderTransformOrigin="0.5,0.5" Margin="4">
                <Path.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform />
                        <SkewTransform />
                        <RotateTransform Angle="0" />
                        <TranslateTransform />
                    </TransformGroup>
                </Path.RenderTransform>
            </Path>
        </Grid>
    </ControlTemplate>

    <ControlTemplate x:Key="WaitIndicatorContainerTemplate" TargetType="{x:Type dxmvvm:WaitIndicatorContainer}">
        <Border Background="#FFF6F6F6" BorderBrush="#FFABABAB" BorderThickness="1">
            <ContentPresenter />
        </Border>
    </ControlTemplate>

    <ControlTemplate x:Key="WaitIndicatorTemplate" TargetType="{x:Type dxmvvm:WaitIndicator}">
        <Grid x:Name="Root" Margin="{TemplateBinding ContentPadding}" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="Collapsed">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="Visibility">
                    <VisualState x:Name="Visible">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Visibility">
                                <DiscreteObjectKeyFrame KeyTime="0:0:0.1">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <BooleanAnimationUsingKeyFrames Storyboard.TargetName="progressBar" Storyboard.TargetProperty="IsIndeterminate">
                                <DiscreteBooleanKeyFrame KeyTime="0:0:0.1" Value="True" />
                            </BooleanAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Collapsed">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity" BeginTime="0:0:0.1" Duration="0:0:0.1" From="1" To="0" />
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Visibility">
                                <DiscreteObjectKeyFrame KeyTime="0:0:0.2">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Collapsed</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <BooleanAnimationUsingKeyFrames Storyboard.TargetName="progressBar" Storyboard.TargetProperty="IsIndeterminate">
                                <DiscreteBooleanKeyFrame KeyTime="0:0:0.1" Value="False" />
                            </BooleanAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <dxmvvm:WaitIndicatorContainer>
                <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <ProgressBar x:Name="progressBar" Background="#FFF6F6F6" BorderBrush="#FF19478A" Foreground="#FF2B579A" BorderThickness="4" Margin="12,12,8,12" Width="40" Height="40" HorizontalAlignment="Center" VerticalAlignment="Center" Template="{StaticResource DefaultWaitIndicator}" IsIndeterminate="True"/>
                    <ContentPresenter Grid.Column="1" Content="{TemplateBinding ActualContent}" Margin="{TemplateBinding Padding}" ContentTemplate="{TemplateBinding ContentTemplate}" VerticalAlignment="Center" />
                </Grid>
            </dxmvvm:WaitIndicatorContainer>
        </Grid>
    </ControlTemplate>

    <DataTemplate x:Key="WaitIndicatorContentTemplate">
        <TextBlock Text="{Binding}" VerticalAlignment="Center" TextWrapping="Wrap"/>
    </DataTemplate>
    <Style TargetType="{x:Type dxmvvm:WaitIndicatorContainer}">
        <Setter Property="Template" Value="{StaticResource WaitIndicatorContainerTemplate}" />
        <Setter Property="Foreground" Value="Black" />
    </Style>
    <Style TargetType="{x:Type dxmvvm:WaitIndicator}">
        <Setter Property="Template" Value="{StaticResource WaitIndicatorTemplate}"/>
        <Setter Property="Padding" Value="0,0,12,0"/>
        <Setter Property="ContentPadding" Value="25"/>
        <Setter Property="Content" Value="{x:Null}"/>
        <Setter Property="ContentTemplate" Value="{StaticResource WaitIndicatorContentTemplate}"/>
    </Style>
</ResourceDictionary>